package cn.wenhe9.service.impl;

import cn.wenhe9.domain.BaseDict;
import cn.wenhe9.domain.Customer;
import cn.wenhe9.mapper.BaseDictMapper;
import cn.wenhe9.mapper.CustomerMapper;
import cn.wenhe9.service.CustomerService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("customerService")
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper mapper;
    @Autowired
    private BaseDictMapper baseNapper;
    @Override
    public List<Customer> findAll(Customer customer) {
        List<Customer> customerList = null;
        try {
            customerList = mapper.findAll(customer);
        }catch (NullPointerException e){

        }
        return customerList;
    }

    @Override
    public List<BaseDict> findSource() {
        return baseNapper.findSource();
    }

    @Override
    public List<BaseDict> findJob() {
        return baseNapper.findJob();
    }

    @Override
    public List<BaseDict> findLevel() {
        return baseNapper.findLevel();
    }

    @Override
    public String create(Customer customer) {
        mapper.create(customer);
        return "OK";
    }

    @Override
    public String delete(int cust_id) {
        mapper.delete(cust_id);
        return "OK";
    }

    @Override
    public Customer findById(int cust_id) {
        return mapper.findById(cust_id);
    }

    @Override
    public String update(Customer customer) {
        mapper.update(customer);
        return "OK";
    }
}
